<?php
/**
 * (actions)
 */
namespace App\Admin\Actions\Products\SkuPacking;

use Encore\Admin\Facades\Admin;
use Encore\Admin\Grid\Tools\AbstractTool;
class ImportSkuPacking extends AbstractTool
{
    /**
     * Render Export button.
     *
     * @return string
     */
    public function render()
    {
        $url = '/xqc/products/sku-packing-upload';

        $up = <<<UP
<li><a href="{$url}?type=packing">导入产品包装规格</a></li>
UP;
        $ship = <<<SHIP
<li><a href="{$url}?type=packing-ship">导入发货箱子规格</a></li>
SHIP;

        $li = '';
        if(Admin::user()->can('sku-packing.up')){
            $li .= $up;
        }
        if(Admin::user()->can('sku-packing.ship')){
            $li .= $ship;
        }

        return <<<EOT

<div class="btn-group">
    <button class="btn btn-sm btn-twitter">导入文件</button>
    <button type="button" class="btn btn-sm btn-twitter dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
        <span class="sr-only">Toggle Dropdown</span>
    </button>
    <ul class="dropdown-menu" role="menu">
        {$li}
    </ul>
</div>
EOT;
    }
}
